﻿// --------------------------------------------------------------------------------------------------------------------
// <copyright file="Matchmaking.cs" company="DissingNelleman">
//   
// All rights reserved. </copyright>
// <summary>
//   The matchmaking.
// </summary>
// --------------------------------------------------------------------------------------------------------------------

namespace ServiceLibrary.Models.Domain
{
    using System;
    using System.Collections.Generic;

    using NHibernate.Mapping.ByCode.Conformist;

    using ServiceLibrary.Models.Base;

    /// <summary>
    /// The matchmaking.
    /// </summary>
    public class Matchmaking : Entity
    {
        #region Constructors and Destructors

        /// <summary>
        /// Initializes a new instance of the <see cref="Matchmaking"/> class.
        /// </summary>
        public Matchmaking()
        {
            this.Partners = new HashSet<MatchmakingPartner>();
            this.OtherFinancing = new HashSet<Fund>();
            this.Funds = new HashSet<Fund>();
            this.OwnerProjects = new HashSet<Project>();
            this.Profiles = new HashSet<Profile>();
        }

        #endregion

        #region Public Properties

        /// <summary>
        /// Gets or sets the buyers.
        /// </summary>
        public virtual string Buyers { get; set; }

        /// <summary>
        /// Gets or sets the comments.
        /// </summary>
        public virtual string Comments { get; set; }

        /// <summary>
        /// Gets or sets the date.
        /// </summary>
        public virtual DateTime? TimeOfActivity { get; set; }

        /// <summary>
        /// Gets or sets the funds.
        /// </summary>
        public virtual ICollection<Fund> Funds { get; set; }

        /// <summary>
        /// Gets or sets the funds text.
        /// </summary>
        public virtual string FundsText { get; set; }

        /// <summary>
        /// Gets or sets the location.
        /// </summary>
        public virtual Location Location { get; set; }

        /// <summary>
        /// Gets or sets the name.
        /// </summary>
        public virtual string Name { get; set; }

        /// <summary>
        /// Gets or sets the other financing.
        /// </summary>
        public virtual ICollection<Fund> OtherFinancing { get; set; }

        /// <summary>
        /// Gets or sets the profiles.
        /// </summary>
        public virtual ICollection<Profile> Profiles { get; set; }

        /// <summary>
        /// Gets or sets the owner projects.
        /// </summary>
        public virtual ICollection<Project> OwnerProjects { get; set; }

        /// <summary>
        /// Gets or sets the partners.
        /// </summary>
        public virtual ICollection<MatchmakingPartner> Partners { get; set; }

        #endregion

        // "Andet"
    }

    /// <summary>
    /// The matchmaking mapping.
    /// </summary>
    public class MatchmakingMapping : ClassMapping<Matchmaking>
    {
        #region Constructors and Destructors

        /// <summary>
        /// Initializes a new instance of the <see cref="MatchmakingMapping"/> class.
        /// </summary>
        public MatchmakingMapping()
        {
            this.Set(x => x.OwnerProjects, c => { }, m => m.ManyToMany());
            this.Property(x => x.Name);
            this.Property(x => x.TimeOfActivity);
            this.ManyToOne(x => x.Location);
            this.Property(x => x.Buyers, m => m.Length(int.MaxValue / 2));
            this.Set(x => x.Funds, c => { }, m => m.ManyToMany());
            this.Property(x => x.FundsText, m => m.Length(int.MaxValue / 2));
            this.Set(x => x.Partners, c => { }, m => m.ManyToMany());
            this.Set(x => x.OtherFinancing, c => { }, m => m.ManyToMany());
            this.Set(x => x.Profiles, c => { }, m => m.ManyToMany());
            this.Property(x => x.Comments, m => m.Length(int.MaxValue / 2));

        }

        #endregion
    }
}